//
//  MyButtonView.m
//  Comma
//
//  Created by 张诗雨 on 15/1/17.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "MyButtonView.h"
#import "Masonry.h"
#import "GlobalMethod.h"
#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self;
@implementation MyButtonView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
    }
    return self;
}
- (void)createView
{
    
//    [GlobalMethod drawLineWithStartPoint:CGPointMake(0, 64) EndPoint:CGPointMake(SCREEN_WIDTH, 64) inUIView:self];
//    [GlobalMethod drawLineWithStartPoint:CGPointMake(0, 108) EndPoint:CGPointMake(SCREEN_WIDTH, 108) inUIView:self];
    UIView *line1 = [[UIView alloc] initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, 0.5)];
    line1.backgroundColor = LINEERGRAY;
    [self addSubview:line1];
    UIView *line2 = [[UIView alloc] initWithFrame:CGRectMake(0, 107, SCREEN_WIDTH, 0.5)];
    line2.backgroundColor = LINEERGRAY;
    [self addSubview:line2];

    
    [self setBackgroundColor:[UIColor whiteColor]];
    WS(weakSelf);
    self.leftLable = [UILabel new];
    self.leftLable.text = @"通知";
    self.leftLable.textAlignment = NSTextAlignmentRight;
    self.leftLable.font = [UIFont boldSystemFontOfSize:15.0f];
    [self addSubview:self.leftLable];
    [self.leftLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(@64);
        make.right.equalTo(weakSelf).with.offset(- (SCREEN_WIDTH/ 2) + 15);
        make.size.mas_equalTo(CGSizeMake(30, 42));
    }];//    self.rightLable = [UILabel new];
//    self.rightLable.text = @"站内信";
//    self.rightLable.font = [UIFont boldSystemFontOfSize:15.0f];
//    [self addSubview:self.rightLable];
//    [self.rightLable mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(@64);
//        make.left.equalTo(weakSelf).with.offset(SCREEN_WIDTH / 2);
//        make.size.mas_equalTo(CGSizeMake(45, 42));
//    }];
    
    self.twigView = [UIView new];
    self.twigView.backgroundColor = TEXTGREENCOLOR;
    [self addSubview:self.twigView];
    [self.twigView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_leftLable.mas_left).with.offset(0);
        make.top.equalTo(_leftLable.mas_bottom).with.offset(0);
        make.size.mas_equalTo(CGSizeMake(30, 2));
    }];
    self.editLable = [UILabel new];
    self.editLable.text = @"编辑";
    self.editLable.font = [UIFont boldSystemFontOfSize:16.0f];
    self.editLable.textColor = TEXTGREENCOLOR;
    [self addSubview:self.editLable];
    [self.editLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(weakSelf).with.offset(-16);
        make.top.equalTo(weakSelf).with.offset(33);
        make.size.mas_equalTo(CGSizeMake(50, 16));
        
    }];
}
- (void)createButton
{
    WS(weakSelf);
    //编辑按钮
    self.editButton = [UIButton new];
    [self addSubview:_editButton];
    [_editButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(weakSelf).with.offset(-10);
        make.top.equalTo(weakSelf).with.offset(30);
        make.size.mas_equalTo(CGSizeMake(70, 30));
    }];
    //返回按钮
    self.backButton = [UIButton new];
    [self addSubview:_backButton];
    [self.backButton setBackgroundImage:[UIImage imageNamed:@"Button_close"] forState:UIControlStateNormal];
    [_backButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf).with.offset(8);
        make.top.equalTo(weakSelf).with.offset(20);
        make.size.mas_equalTo(CGSizeMake(44, 44));
    }];
    
    // 通知按钮
    self.leftButton = [UIButton new];
    [self addSubview:self.leftButton];
//    self.leftButton.backgroundColor = [UIColor blackColor];
    [self.leftButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(@64);
        make.right.equalTo(weakSelf).with.offset(- (SCREEN_WIDTH/ 2) + 15);
        make.size.mas_equalTo(CGSizeMake(30, 42));
    }];
//    // 站内信按钮
//    self.rightButton = [UIButton new];
//    [self addSubview:self.rightButton];
//    [self.rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(@64);
//        make.left.equalTo(weakSelf.leftButton.mas_right).with.offset(0);
//        make.size.mas_equalTo(CGSizeMake(60, 42));
//    }];
//    
//    
}

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

@end
